package state.source;

/**
 * 维护一个ConcreteState子类的实例，定义了当前的状态
 * @author Chen Guang
 * @date 2019/4/16 0016 上午 10:18
 */
public class Context {
    private State state;

    public Context(State state) {
        this.state = state;
    }


    public State getState() {
        return state;
    }

    public void setState(State state) {
        System.out.println("当前状态为" + state.getClass().getName());
        this.state = state;
    }

    public void request(){
        state.handle(this);
    }
}
